<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Illuminate\Database\Eloquent\Model;

class CaseContract extends Model
{
	use HasDateTimeFormatter, HasRelationships;
    protected $table = 'case_contracts';
    public $timestamps = false;

    public function caseCustomer()
    {
        return $this->belongsTo(CaseCustomer::class);
    }

    public function caseEvents()
    {
        return $this->hasMany(CaseEvent::class);
    }

    public function caseBatchs()
    {
        return $this->hasMany(CaseBatch::class);
    }

    public function Attachments()
    {
        return $this->hasMany(Attachment::class);
    }

    public function caseReceipts()
    {
        return $this->hasManyDeep(CaseReceipt::class, [CaseBatch::class, CaseCase::class]);
    }

    public function caseCases()
    {
        return $this->hasManyThrough(CaseCase::class, CaseBatch::class);
    }

}
